-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
ICML writer: add FirstParagraph and Bibliography styles. #11273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Nice! But I don't quite understand how the "in addition" part would work (I don't know enough about XML). I also don't know if ICML or Indesign would support that as in Indesign one can choose only one "based on" style per style. Also there is only one style per paragraph in Indesign. Good point about disruption. It is true that previous suggestion might break layouts before designer assigns FirstParagraph to be based on Paragraph. But I did a quick test to see how Indesign references parent styles. It seems that FirstParagraph and Bibliography styles can be based on Paragraph like this: Attached example does this and loads as expected into Indesign. When relinking already placed ICML to a new version the following happens:
I guess doing it like this (by basing FirstParagraph and Bibliography on Paragraph) would mean that everything works as before. In old layouts the additional styles would appear in style list and can be defined from there or completely ignored. |
|
Yes, we could do it this way, but it would require some futzing with the way styles are now generated. What about the other option: simply assigning both Paragraph and FirstParagraph styles? Does that work? Can styles override each other like in CSS? |
|
I don't think multiple styles can be added to same element. In ICML paragraph style is set with attribute and to my understanding there can be only one value per XML attribute. As the value is a string adding new items to it would make it a different string. Trying to add more "AppliedParagraphStyle" key-value pairs to an ParagraphStyleRange element generates error message "Duplicate attribute". But nested definitions like this do seem to work if these are better match for pandoc: |
|
We do use multiple styles, though. |
|
Hmm I see (and maybe finally understand too), but isn't that just a single style which is named to look like two styles from XML point of view? There is a specific style with matching name in ICML root styles section: Pandoc's multiple styles are a single style in ICML (a key-value pair). Every used style needs to also exist in ICML's root styles section to work. If e.g. So while "Name" and "Self" attribute values can be a list of styles that list is a single string identifier in ICML. Working example that mimics this is attached. It would be nice if the new first paragraph root style would have BasedOn tag with "ParagraphStyle/Paragraph" to keep existing layouts the same (as in attached example ICML). But for me getting first paragraphs and bibliography tagged is more important as that change is quick to do in Indesign. |
|
Hm. Wouldn't we also need to say what |
|
Hmm true, I didn't think of that. But yes, if those styles are added it would be preferable to base their style to the element's basic style. Then change would be invisible in existing layouts with linked content (and ready for styling as a bonus as these new styles just appear in Indesign's style list). It also makes sense to have them (like for styling the first paragraph of a blockquote). If every block has a first paragraph can it create a long list of emitted styles in ICML with nested content (I've no clue about pandoc's nesting levels or rules)? E.g. |
|
Block quotes can't be nested inside paragraphs. So you should only have FirstParagraph at the end of one of these sequences. |
|
That sounds fine! Is this a complicated to do? Bibliography paragraphs probably have no need for "first" style and maybe there are others than can be omitted. |
Paragraph styles. This should ensure that existing documents still work with the FirstParagraph style, without the need to define new styles.
|
OK, I have implemented a system where |
Closes #11268.
Not sure this is the right approach. Would it be better to add FirstParagraph in addition to Paragraph? (And similarly for Bibliography?) If the styles are nestable in this way (I don't know a thing about ICML), then this would be less disruptive, as people who have customized the Paragraph style would not need to do anything special when using the new writer.
Alternatively, perhaps we could have the style define the FirstParagraph and Bibliography styles in terms of Paragraph. (But this is less ideal for various reasons.)